package com.bzm.config;

import javax.servlet.http.HttpServletResponse;

import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;

import com.bzm.common.entity.HttpCode;
import com.bzm.common.entity.JsonResult;

import lombok.extern.slf4j.Slf4j;

@Slf4j
@ControllerAdvice
public class GlobalExceptionHandler {
	
 	@ExceptionHandler
    @ResponseBody
    public JsonResult<String> exceptionHandler(Exception e, HttpServletResponse response) {
        log.info("。。。。。。。全局异常处理。。。。。。。。。。");
        // 记录日志
        e.printStackTrace();
        return new JsonResult<String>(null, HttpCode.EXCEPTIONS);
    }
	
}
